
!function(window, document, $, undefined) {
	
	var init = {
		eventList: function(){
			var $pathList = $('#implantation').contents().find('#pathList').find('path');
			$('body').on('click', '#close', this.closeOnClick);
			$pathList.on('mouseover', this.pathListMouseover);
			$pathList.on('mouseout', this.pathListMouseout);
		},
		pathListMouseover: function() {
			var $this = $(this);
			var uid = $this.attr('id');
			$.ajax({
				url:'./data.json',
				type: 'get',
				dataType: 'json',
				success: function(response) {
					if(!response) return;
					var callNum = response.callInfoRecordNumBigScreenSXs;
					$.each(callNum, function(ind, key) {
						$('#'+key.name).append(
							'<span class="tips">今日呼入次数 '+key.num+'次</span>'
						)
					})
				}
			})
			$('#'+uid).find('.tips').show();
		},
		pathListMouseout: function() {
			var $this = $(this);
			var uid = $this.attr('id');
			$('#'+uid).find('.tips').hide();
		},
		closeOnClick: function() { // 关闭弹窗
			var $this = $(this);
			$this.parents('.sosInfor').hide();
		},
		/*
		phoneBroken: function() { // 电话呼入折线图
			var phonebrokenLine = echarts.init(document.getElementById('brokenLine'));
			option = {
			    xAxis: {
			        type: 'category',
			        boundaryGap: false,
			        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
			        axisLabel: {
		                show: 	true,
		                textStyle: {
		                    color: '#75bcff'
		                }
		            },
		            axisLine:{
		                lineStyle:{
		                    color:'#5b7b80'
		                }
		            },
		            splitLine:{  // 显示垂直网格线
		                show: true,
		                lineStyle:{
		                    color:'#75bcff'
		                }
		            }
			    },
			    yAxis: {
			        type: 'value',
			        axisLabel: {
		                show: true,
		                textStyle: {
		                    color: '#75bcff'
		                }
		            },
		            axisLine:{
		                lineStyle:{
		                    color:'#5b7b80'
		                }
		            },
		            splitLine:{
		                show: false
		            }
			    },
			    series: [{
			        data: [820, 932, 901, 934, 1290, 1330, 1320],
			        type: 'line',
			        areaStyle: {
			        	color: '#135877'
			        },
			        itemStyle : {
						normal : {
							lineStyle:{
								color:'#58b0f0'
							}
						}
					}
			    }]
			};
			phonebrokenLine.setOption(option);
		},*/
		// 电话呼入折线图********************前后对接版

		phoneBroken: function(){
			var phonebrokenLine = echarts.init(document.getElementById('brokenLine'));
			var phoneInfos;
			$.ajax({
				//url: 'http://localhost:9527/wz/servicecall/countCallInWeek',
				url: '/wz/servicecall/countCallInWeek',
				type: 'get',
				dataType: 'json',
				success: function(response){
					phoneInfos = response.data;
					//console.log(phoneInfos[0].count);
					
					
					option = {
					    xAxis: {
					        type: 'category',
					        boundaryGap: false,
					        data: ['周一', '周二', '周三', '周四', '周五', '周六', '周日'],
					        axisLabel: {
					            show: 	true,
					            textStyle: {
					                color: '#75bcff'
					            }
					        },
					        axisLine:{
					            lineStyle:{
					                color:'#5b7b80'
					            }
					        },
					        splitLine:{  // 显示垂直网格线
					            show: true,
					            lineStyle:{
					                color:'#75bcff'
					            }
					        }
					    },
					    yAxis: {
					        type: 'value',
					        axisLabel: {
					            show: true,
					            textStyle: {
					                color: '#75bcff'
					            }
					        },
					        axisLine:{
					            lineStyle:{
					                color:'#5b7b80'
					            }
					        },
					        splitLine:{
					            show: false
					        }
					    },
					    series: [{
					        data: [phoneInfos[0].count, phoneInfos[1].count, phoneInfos[2].count, phoneInfos[3].count, phoneInfos[4].count, phoneInfos[5].count, phoneInfos[6].count],
					        type: 'line',
					        areaStyle: {
					        	color: '#135877'
					        },
					        itemStyle : {
								normal : {
									lineStyle:{
										color:'#58b0f0'
									}
								}
							}
					    }]
					};
					
					phonebrokenLine.setOption(option);
			
				},
				
			})
			
		},

		
	   // 电话呼入饼状图*****************前后对接版
	   phoneChart: function(){
	   	var phoneNum = echarts.init(document.getElementById('phoneNum'));
	   	var phoneNumInfos;
	   	$.ajax({
	   		//url: 'http://localhost:9527/wz/servicecall/countCallType',
	   		url: '/wz/servicecall/countCallType',
	   		type: 'get',
	   		dataType: 'json',
	   		success: function(response){
	   			phoneNumInfos = response.data;
				//console.log(phoneNumInfos[0].count);
	   			
	   			
	   			option = {
	   			    tooltip: {
	   			        trigger: 'item',
	   			        formatter: "{a} <br/>{b}: {c} ({d}%)"
	   			    },
	   			    legend: {
	   			        orient: 'vertical',
	   			        x: 'left',
	   			        selectedMode:false,//取消图例上的点击事件
	   			        data:[phoneNumInfos[0].callTypeName,phoneNumInfos[1].callTypeName,phoneNumInfos[2].callTypeName,phoneNumInfos[3].callTypeName,phoneNumInfos[4].callTypeName],
	   			        padding: [20, 0, 0, 0],
	   			        textStyle: {color: '#fff'}
	   			    },
	   			    series: [
	   			        {
	   			            name:'访问来源',
	   			            type:'pie',
	   			            radius: ['50%', '70%'],
	   			            avoidLabelOverlap: false,
	   			            animation: false,
	   			            hoverAnimation: false,
	   			            itemStyle: {
	   			            	labelLine : {
	   			                    show : true   //隐藏标示线
	   			               }
	   			            },
	   			            label: {
	   			            	show: false,
	   			                normal: {
	   			                    show: true
	   			                },
	   			                emphasis: {
	   			                    show: true
	   			                },
	   			                legend: {
	   			            		itemStyle: {
	   			            			color: '#fff'
	   			            		}
	   			            	}
	   			            },
	   			            labelLine: { // 饼状图周围标注的线
	   			                normal: {
	   			                    show: true
	   			                }
	   			            },
	   			            data:[
	   			                {value:phoneNumInfos[0].count, name:phoneNumInfos[0].callTypeName},
	   			                {value:phoneNumInfos[1].count, name:phoneNumInfos[1].callTypeName},
	   			                {value:phoneNumInfos[2].count, name:phoneNumInfos[2].callTypeName},
	   			                {value:phoneNumInfos[3].count, name:phoneNumInfos[3].callTypeName},
	   			                {value:phoneNumInfos[4].count, name:phoneNumInfos[4].callTypeName}
	   			            ]
	   			        }
	   			    ]
	   			};
	   			phoneNum.setOption(option);
	   	
	   		},
	   		
	   	})
	   	
	   }
	   
	   
		
		

	}

	//init.fillList();
	init.phoneChart();
	init.phoneBroken();
	//init.mapAddDot();
	init.eventList();

}(window, document, jQuery)
//
//
//
//左下
var orderItems=document.getElementById("orderItems");

orderItems.onload = $(function(){
	$.ajax({
		type:'GET',
		//url:'http://localhost:9527/wz/serviceorder/orderList',
		url:'/wz/serviceorder/orderList',
		data() {},
		success:function({data}){

			var arr=data;

			var workid='';
			for (var i = 0; i < arr.length; i++) {
				const work = arr[i];
				workid += '<li>'+ arr[i].time+'</li>'+'<li>'+ arr[i].name+'</li>'+'<li>'+ arr[i].task+'</li>'+'<li>'+ arr[i].tissue+'</li>'+'<li>'+ arr[i].state+'</li>';
			}
			orderItems.innerHTML=workid;
		},
	})
})
//中部sos

//右上

var right_1 = document.getElementById("right_1");
right_1.onload = $(function(){
	$.ajax({
		type:'GET',
		//
		//url:'http://localhost:9527/wz/serviceorder/orderCount',
		url:'/wz/serviceorder/orderCount',
		data() {},
		success:function({data}){

			//


			var workid_2='';

			workid_2 = '<div><span class="serNum">'+data+'</span>单</div><p>惠民服务订单数</p>';
			right_1.innerHTML=workid_2;
		},
	})
})

var right_2 = document.getElementById("right_2");
right_2.onload = $(function(){
	$.ajax({
		type:'GET',
		//
		//url:'http://localhost:9527/wz/servicecall/getCallCountInWeek',
		url:'/wz/servicecall/getCallCountInWeek',
		data() {},
		success:function({data}){

			//
			var arr2=data;
			//console.log(arr2);


			var	workid_3 =  '<div><span class="serNum">'+arr2+'</span>单</div><p>当前呼吸量</p>';

			right_2.innerHTML=workid_3;
		},
	})
})

var weather = document.getElementById("weather");
weather.onload = $(function(){
	$.ajax({
		type:'GET',
		//
		//url:'http://localhost:9527/wz/servicecall/getWeather',
		url:'/wz/servicecall/getWeather',
		//url:'http://wthrcdn.etouch.cn/weather_mini?city=驻马店',
		data() {},
		success:function({data}){

			//

			console.log(data);


			weather.innerHTML=data;
		},
	})
})